<?php
if(isset($_POST['submit']))
{
	include('connection/connection.php');
	$email_to=$_POST['email_to'];
	$sql="SELECT password FROM tbl_dtls_createuser WHERE emailid='$email_to'";
	$result=mysql_query($sql);
	$count=mysql_num_rows($result);
	if($count==1)
	{
		$rows=mysql_fetch_array($result);
		$your_password=$rows['password'];

// ---------------- SEND MAIL FORM ----------------
		$to=$email_to;
		$subject="Your password here";
		$header="from: your name <your email>";
		$messages= "Your password for login to our website \r\n";
		$messages="Your password is $your_password \r\n";
		$sentmail = mail($to,$subject,$messages,$header);
	}
//else if $count not equal 1
	else
	{
		echo "Not found your email in our database";
	}
	if($sentmail)
	{
		echo "Your Password Has Been Sent To Your Email Address.";
	}
	else 
	{
		echo "Cannot send password to your e-mail address";
	}
}
?>
<html>
<body>
<table width="380" border="0" cellpadding="3" cellspacing="1" >
<tr>
<td width="33%">Enter your email:</td>
<td width="67%">
<form action="" method="post" name="ep" id="ep">
<input name="email_to" type="text" id="email_to" size="25">
<input type="submit" name="submit" value="Submit">
</form>
</td>
</tr>
</table>

</body>
</html>